package com.sphd.beautysalon.base;

import android.content.Context;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;
import android.util.Log;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.Volley;
import com.sphd.beautysalon.utils.BitmapCache;
import com.sphd.beautysalon.utils.VolleyUtil;

import org.litepal.LitePalApplication;

/**
 * Created by Hu on 2016/10/25.
 */

public class RestaurantsApplication extends MultiDexApplication {
    private static ImageLoader imageLoader;
    private static RequestQueue requestQueue;
    private static VolleyUtil volleyUtil;;
    private static Context context;

    @Override
    public void onCreate() {
        super.onCreate();
        LitePalApplication.initialize(this);
        Log.e("RestaurantsApplication", "RestaurantsApplication");
        volleyUtil=new VolleyUtil();
        context=getApplicationContext();
        requestQueue = Volley.newRequestQueue(getApplicationContext());
        imageLoader = new ImageLoader(requestQueue, new BitmapCache());
//        imageLoader = new ImageLoader(requestQueue, new ImageCacheUtil(context));

    }
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
    public static ImageLoader getImageLoader() {
        return imageLoader;
    }

    public static RequestQueue getRequestQueue() {
        return requestQueue;
    }

    public static VolleyUtil getVolleyUtil() {
        return volleyUtil;
    }

    public static Context getContext() {
        return context;
    }

}
